import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import 'element-ui/lib/theme-chalk/index.css' // 默认主题
// import './assets/css/theme-green/index.css'; // 浅绿色主题
import './assets/css/icon.css'

import axios from 'axios'

Vue.config.productionTip = false

// axios.defaults.baseURL = '/adminApi' // 设置根url

const service = axios.create({
  timeout: 100 * 30,
  baseURL: '/adminApi',
  withCredentials: true,
  headers: {
    'Content-Type': 'application/json; charset=utf-8'
  }
})

service.interceptors.request.use(config => {
  config.headers.token = window.sessionStorage.getItem('token')
  return config
})

Vue.prototype.$http = service // 挂在axios

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
